package com.puscene.framwork.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;


public class NetWork {
	private ConnectivityManager manager;

	public NetWork(Context context) {
		this.manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
	}
	
	public boolean isAvailable() {
		NetworkInfo info = manager.getActiveNetworkInfo();
		return (info != null && info.isConnectedOrConnecting());
	}
	
	public boolean isWifi(){
		return manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == State.CONNECTED;
	}
}
